#pragma once
#include "../../Renderer/Header Files/CRendererIncludes.h"
#include "../Header Files/CBaseObject.h"
#include <vector>
using namespace std;

struct SFrame
{
	RECT DisplayRect;

	RECT CollisionRect;

	POINT Anchor;

	string Event;

	double dFrameLength;
};

class CAnimation
{
private:
	int m_nImageID;
	int m_nCurrFrame;
	bool m_bIsPlaying, m_bIsLooping;
	vector<SFrame*> m_vFrames;
	CBaseObject* m_pOwner;
public:
	// conStructor
	CAnimation(CBaseObject* pOwner);
	~CAnimation();


	// Accesors
	int GetImageID()	{ return m_nImageID; }
	int GetCurrFrame()	{ return m_nCurrFrame; }
	bool IsPlaying()	{ return m_bIsPlaying; }
	bool IsLooping()	{ return m_bIsLooping; }

	// Mutators
	void SetImageID( int _nImageID )			{ m_nImageID = _nImageID; }
	void SetIsPlaying( bool _bIsPlaying )		{ m_bIsPlaying = _bIsPlaying; }
	void SetIsLooping( bool _bIsLooping )		{ m_bIsLooping = _bIsLooping; }
	void AddFrame( SFrame *_Frame )				{ m_vFrames.push_back(_Frame); }

	void Update( float _Dt );
	void Render();
	void Reset();
};